package com.dubito.pattern.创建型模式.工厂模式.简单工厂;

/**
 * @author liliang
 * @date 2020/8/26.
 * 具体工厂
 */
public class ConcreteCreator implements Creator {
    
    @Override
    public <T extends Product> T factory(Class<T> clazz) {
        Product product = null;
        try {
            product = (Product) Class.forName(clazz.getName()).newInstance();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return (T) product;
    }
}
